package nuc.edu.dao;



import nuc.edu.entities.Department;
import nuc.edu.entities.Employee;
import nuc.edu.mapper.EmployeeMapper;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;

import java.io.IOException;
import java.io.InputStream;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Repository
public class EmployeeDao {

	@Autowired
	public EmployeeMapper employeeMapper;

	public void save(Employee employee){
		employeeMapper.save(employee);
	}

	public void update(Employee employee){
		employeeMapper.update(employee);
	}

	//查询所有员工
	public Collection<Employee> getAll(){
		return employeeMapper.getAll();
	}

	public Employee get(Integer id){
		return employeeMapper.get(id);
	}

	public void delete(Integer id){
		employeeMapper.delete(id);
	}

	public List<Employee> getEmployeeByDid(Integer did){
		return employeeMapper.getEmployeeByDid(did);
	}
}
